<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>使用列表来操作对象</title>
  <script>
    let arr = [
      {name:'zhangsan',age:18},
      {name:'lisi',age:20},
      {name:'wangwu',age:22},
      {name:'zhaoliu',age:24},
      {name:'tianqi',age:26},
      {name:'sunqi',age:28},
      {name:'liuliu',age:30},
      {name:'liqi',age:30},
    ]
   console.log(arr);
   //使用find来查找对象，find查找的是一个对象
   let peron = arr.find((item,index)=>index==2)
   console.log(peron);
   person = arr.find(item=>item.name=='sunqi')
   console.log(person);
   //使用filter来查找对象，filter查找的是一个数组
   let ps = arr.filter((item=>item.age>=22))
   console.log(ps);
   let pos = arr.findIndex(item=>item.name=='zhaoliu')
   console.log(pos);
   arr.splice(pos,1)
   console.log(arr);
   
  </script>
</head>
<body>
  
</body>
</html>